﻿//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
// Exo² - Tools - Studio/ExefReaderModule
// Copyright (C) 2007-2008 Samuel Lacroix and Raphaël Legouge
//
// Distributed under GNU General Public License
// See the License folder for details
// http://www.codeplex.com/exo2 (eng)
//-----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ExefReaderModule
{
    public partial class PhysiologyChoice : Form
    {
        public PhysiologyChoice()
        {
            InitializeComponent();

            ResetForm();
        }

        private string[] names;

        public void SetNames(string[] names)
        {
            this.names = names;
            UpdateForm();
        }

        public string GetSelectedName()
        {
            return this.comboBox1.Text;
        }

        public void ResetForm()
        {
            this.names = null;
            this.comboBox1.Items.Clear();
            this.comboBox1.Text = "";
        }

        private void UpdateForm()
        {
            this.comboBox1.Items.AddRange(this.names);
            this.comboBox1.Text = (string)this.comboBox1.Items[0];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.comboBox1.Items.IndexOf(this.comboBox1.Text) >= 0)
                this.DialogResult = DialogResult.OK;
            else
                MessageBox.Show("la physiology n'existe pas");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
